import request from '@/utils/request'

// 创建app用户
export function createAppMemberUser(data) {
  return request({
    url: '/member/app-member-user/create',
    method: 'post',
    data: data
  })
}

// 更新app用户
export function updateAppMemberUser(data) {
  return request({
    url: '/member/app-member-user/update',
    method: 'put',
    data: data
  })
}

// 删除app用户
export function deleteAppMemberUser(id) {
  return request({
    url: '/member/app-member-user/delete?id=' + id,
    method: 'delete'
  })
}

// 获得app用户
export function getAppMemberUser(id) {
  return request({
    url: '/member/app-member-user/get?id=' + id,
    method: 'get'
  })
}

// 获得app用户分页
export function getAppMemberUserPage(query) {
  return request({
    url: '/member/app-member-user/page',
    method: 'get',
    params: query
  })
}

// 导出app用户 Excel
export function exportAppMemberUserExcel(query) {
  return request({
    url: '/member/app-member-user/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 用户密码重置
export function resetAppMemberPwd(id, password) {
  const data = {
    id,
    password
  }
  return request({
    url: '/member/app-member-user/update-password',
    method: 'put',
    data: data
  })
}

// 用户状态修改
export function changeUserStatus(id, status) {
  const data = {
    id,
    status
  }
  return request({
    url: '/member/app-member-user/update-status',
    method: 'put',
    data: data
  })
}

// 关联大户
export function associationContract(id) {
  return request({
    url: '/member/app-member-user/association?id=' + id,
    method: 'get',
  })
}
